<?php
use yii\helpers\Html;

$this->title = "项目详情页抵押类";
echo Html::cssFile('@web/css/projectMortgage.css');
$this->registerJsFile('/js/select2.min.js');
$this->registerJsFile('/js/projectMortgage.js');
$this->registerJsFile('/js/jquery.validate.min.js');
$this->registerJsFile('/js/jquery.validate.extend.js');
$this->registerJsFile('/js/messages_zh.js');
$package_id = Yii::$app->request->get("package_id");
$project_id = Yii::$app->request->get("project_id");
?>
<style type="text/css">
	.nav-fix {
		margin-bottom: 46px!important;
	}
	.details-btns .btn-primary {
	    color: none;
	    background-color: #ffffff !important;
	    border: 0px solid #2194f1 !important;
	}
   .interview4W tr td:last-child{
   	padding: 0 10px!important;
   }
     .interview4W tr td pre{
   		padding:10px 0px!important;
   }
     .interview4W tr td input[type="text"]{
   		padding:10px 0px!important;
   }
   
    .interview4W tr td:nth-child(2) {
   		padding-left:10px!important;
   }
   
   
     .interview4W tr:nth-child(6) td input[type='text']{
   		padding: 0px!important;
   }

	.wrap > .container-fluid > .container{width: 100%; padding: 0; margin: 0; }
	
	.DiYazhuanRangXinXi .zhuanRang .yTime{
		margin-top: -20px;
	}
	.DiYazhuanRangXinXi .zhuanRang .yTime input[type='text']{
		margin-top: 34px!important;
	}
	
	.diYaZhuanRangXinXi .zhuanRangS{
		margin-top: 10px!important;
	}
	.diYaZhuanRangXinXi .zhuanRangText {
		margin-top: 15px;
	}
	.diYaZhuanRangXinXi .zhuanRangPre {
		margin-top: 15px;
	}
	
	 .diYaZhuanRangXinXi p span {
	    line-height: 37px;
	}
	.diYaZhuanRangXinXi .timePre {
		margin-top: -39px;
	}

    .edit-tabs-ul1>li>a{
        display: inline-block;
        width: 105px;
        margin-left: -10px;
    }

    /** 联想搜索 **/
    .select2-results__message{display: none;}
    .selectText{  margin-left: 0;  margin-right: 4%  }
</style>
		<a href="#" class="clicktop" title="返回顶部">
			<!--<img src="image/common/clickTop.png" alt=""  />-->
		</a>
		<!--一键置 顶结束-->
		<!-- 删除模态框开始（Modal） -->
		<div class="container-fluid text-center">
			<div class="row">
				<div class="modal fade" id="deleModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="false">
					<div class="modal-dialog">
						<div class="modal-content">
							<div class="modal-header clearfix">
								<div class="pull-left">
									<img class="pull-left" src="/image/projectDetails/mask.png" />
									<span class="pull-left uploadText">删除选项</span>
								</div>
								<img class="pull-right uploadImg" data-dismiss="modal" aria-hidden="true" src="/image/projectDetails/clos.png" title="单击关闭遮罩层" style="margin-top: 10px; cursor: pointer;">

							</div>
							<div class="modal-body">
								<p>你确定删除选中内容吗?</p>
							</div>
							<div class="modal-footer" style="display: block;">
								<div class="cancelInConfirm">
									<input id='modal-cancel' class="cancelInConfirmActive" type="button" value="确定" data-dismiss="modal" />
									<input id="modal-confirm" class="active" type="button" value="取消" data-dismiss="modal" />
								</div>
							</div>
						</div>
					</div>
				</div>

			</div>
		</div>


		<!-- 资产包详情  开始-->
		<div class="container details">
            <?=
            $this->render('project-start-mortgage',['Base'=>$Base,'packageName'=>$packageName,'teamInfo'=>$teamInfo,'projectModel'=>$project]);
            ?>
		</div>
		<!-- 资产包详情  结束 -->

		<!-- 页内导航   开始-->
		<div class="container edit-tabs navFix" style="z-index: 1!important;">
            <?=
            $this->render('project-navigation-mortgage',['package_id'=>$package_id, 'project_id'=>$project_id])
            ?>
		</div>

		<!-- 页内导航   结束-->

		<!--基本信息-->
		<div class="jiBenXinXi jiBenXinXiDOM" id="jiBen">
            <?=
            $this->render('project-base-mortgage',['Base'=>$Base,'provinceData'=>$provinceData,'state'=>$state]);
            ?>
		</div>

		<!--司法进展-->
		<div class="suSongXinXi suSongXinXiDOM" id="siFa">
            <?=
            $this->render('project-judicial-mortgage',['Lawsuit'=>$Lawsuit]);
            ?>
		</div>

		<!--抵押物情况-->
		<div class="liuZhuanJiWieHu diyawuInfoHtml" id="diYa">
            <?=
                $this->render('project-state-mortgage',['mortgageStateList'=>$mortgageStateList,'mortgageCount'=>$mortgageCount]);
            ?>
            <!--抵押物情况 table-->
            <?php
                if (!empty($mortgageCount) && $mortgageCount>0){
                    echo $this->render('project-state-mortgage-ul',['mortgageCount'=>$mortgageCount,'mortgageStateList'=>$mortgageStateList]);
                    echo $this->render('project-state-mortgage-table',['mortgageInfoTable'=>$mortgageInfoTable,'mortgageStateTable'=>$mortgageStateTable,'SealStateTable'=>$SealStateTable,'InterviewTable'=>$InterviewTable,'EvaluationTable'=>$EvaluationTable]);
                }
            ?>
		</div>
		<!--非抵押物情况-->
		<div class="jiBenXinXi top10 feiDiyaDom" id="feiDiYa">
            <?=
            $this->render('project-n-state-mortgage',['nonMortgage'=>$nonMortgage]);
            ?>
		</div>

		<!--回现评估-->
		<div class="jiBenXinXi pingguDOM top10" id="huiXian">
            <?=
            $this->render('project-pinggu-mortgage',['payment'=>$payment]);
            ?>
		</div>

<!--//转让信息-->
<div class="zhuanRangXinXi zhuanRangXinXiList zhuanRangXinXiW diYaZhuanRangXinXi" id="zhuanRang" >
    <?= $this->render('make', [
        'transfer'=>$transfer,
    ])
    ?>
</div>

<!--转让信息编辑-->
<div class="zhuanRangXinXi  zhuanRangXinXiEdit DiYazhuanRangXinXi" id="zhuanRang" style="display: none;">
</div>

<!--//流转、前期处置及维护情况-->
<div class="liuZhuanJiWieHu liuZhuanJiWieHuW" id="liuZhuan" >
    <?= $this->render('maintain', [
        'transferHistory'=>$transferHistory,
    ])
    ?>
</div>
<!--//流转、前期处置及维护情况编辑-->
<div class="liuZhuanJiWieHu liuZhuanEdit liuZhuanJiWieHuEdit diYaliuZhuanEdit" id="liuZhuan" style="display: none;">
</div>


<!--//团队成员-->
<div class="tuanDuiChengYuan tuanDuiChengYuanW" id="tuanDui">
    <?= $this->render('team', [
        'team'=>$team,
        'teamXZR'=>$teamXZR,
        'teamFZR'=>$teamFZR,
        'teamZJ'=>$teamZJ,
    ])
    ?>
</div>
<!--<!--//团队成员编辑-->
<div class="tuanDuiChengYuan tuanDuiChengYuanEdit" id="tuanDui" style="display: none;">

</div>


<div class="modal fade" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModal">
    <?php
    echo $this->render('modal/asset-project-editing-permissions', ['projectid' => $Base['id'], 'departments' => $Base['departments'], 'access' => $Base['access'], 'access_users_ids' => $Base['access_users_ids']]);//修改访问权限
    ?>
</div>
<div class="modal fade" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModal2">
    <?php
    //var_dump($team);exit;
    echo $this->render('modal/asset-project-editing-team', ['projectid' => $Base['id'],'userChief'=>$userChief,'user'=>$user,'team'=>$team, 'teamXZR'=>$teamXZR, 'teamFZR'=>$teamFZR,'teamZJ'=>$teamZJ]);
    ?>
</div>
<!-- Modal -->
<div class="modal fade modal-focus" id="myModalLabel" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-body">
                <div class="modal-body-focus">
                    <img src="/image/assetPackage/smile.png">
                    <p class="focus">关注成功</p>
                    <p>有更新系统会第一时间通知您</p>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-primary btns-primary" data-dismiss="modal">确定</button>
            </div>
        </div>
    </div>
</div>
<!-- 模态窗口  结束!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<script>
	
	
    var project_id = '<?= Yii::$app->request->get("project_id",1)?>';
    var package_id = '<?= Yii::$app->request->get("package_id",1)?>';

    $(".like").on('click', function () {
        var value = $(this).attr('data').split('-');
        var url = '/project/set-project-like';
        if (value[2] == 2) {
            url = '/project/set-project-light';
        }
        $.get(url, {'project_id': project_id, 'del': value[1], 'type': value[2]}, function (res) {
            if (res.status) {
                $("#" + value[0] + "_img").attr('src', res.img);
                $("#" + value[0]).attr('data', value[0] + '-' + res.type + '-' + value[2]);
                if (res.type == 1 && value[2] == 1) {
                    $('#myModalLabel').modal('show');
                } else {
                    layer.msg(res.msg);
                }
            } else {
                layer.msg(res.msg);
            }
        });
    });
	
	var editImg  = true; 
    $(document).on('click','#getBase,#getJudicial,#feiDiYaImg,#getPingGu,#getPingGuData',(function () {
    	 $(".textarea-edit").focus(function(){
    	 	$(this).css({
    	 		'border':'1px solid #2194f1'
    	 	})
	      var val = $(this).val();
	       $("#d1").width($(this).width())
	      $("#d1").html("<pre>" +val+" "+"</pre>");
	      var h = $("#d1").height() ;
	      $(this).height(h);
	    });
	     $(".textarea-edit").blur(function(){
	     	$(this).css({
    	 		'border':'1px solid #E2E2E2'
    	 	})
	     })
	    $(".textarea-edit").keyup(function(){
	         
	      var val = $(this).val();
	       $("#d1").width($(this).width())
	      $("#d1").html("<pre>" +val+" "+"</pre>");
	      var h = $("#d1").height() ;
	      $(this).height(h);
	    });
	    
	    $('input').focus(function(){
	    	$(this).css({
    	 		'border':'1px solid #2194f1'
    	 	})
	    })  
	    $('select').focus(function(){
	    	$(this).css({
    	 		'border':'1px solid #2194f1'
    	 	})
	    })
	    $('input').blur(function(){
	    	$(this).css({
    	 		'border':'1px solid #E2E2E2'
    	 	})
	    }) 
	     $('select').blur(function(){
	    	$(this).css({
    	 		'border':'1px solid #E2E2E2'
    	 	})
	    }) 
    	
    	 if(editImg){
            var postionVal = $(this).data('val');
            switch (postionVal) {
                case 1:
                    $.get('/project/get-base-data/',{project_id:project_id,postion:postionVal,package_id:package_id},function (res) {
                        var JData = JSON.parse(res);
                        if (JData.code==200){
                            editImg  = false;
                            $(".baseEdit").show();
                            $(".baseW").hide();
                            $(this).hide();
                        }else{
                            layer.msg(JData.message)
                            location.reload();
                        }
                    });
                    break;
                case 2:
                    $.get('/project/get-base-data/',{project_id:project_id,postion:3,package_id:package_id},function (res) {
                        var JData = JSON.parse(res);
                        if (JData.code==200){
                            editImg  = false;
                            $(".judicialEdit").show();
                            $(".judicialW").hide();
                            $(this).hide();
                        }else{
                            layer.msg(JData.message)
                            location.reload();
                        }
                    });
                    break;
                case 3:
                    $.get('/project/get-base-data/',{project_id:project_id,postion:21,package_id:package_id},function (res) {
                        var JData = JSON.parse(res);
                        if (JData.code==200){
                            editImg  = false;
                            $(".feidiyaEdit").show();
                            $(".feidiyaW").hide();
                            $(this).hide();
                        }else{
                            layer.msg(JData.message)
                            location.reload();
                        }
                    });
                    break;
                case 4:
                    $.get('/project/get-base-data/',{project_id:project_id,postion:22,package_id:package_id},function (res) {
                        var JData = JSON.parse(res);
                        if (JData.code==200){
                            editImg  = false;
                            $(".pingguEdit").show();
                            $(".pingguW").hide();
                            $(this).hide();
                        }else{
                            layer.msg(JData.message)
                            location.reload();
                        }
                    });
                    break;
                case 5:
                    $.get('/project/get-base-data/',{project_id:project_id,postion:15,package_id:package_id},function (res) {
                        var JData = JSON.parse(res);
                        if (JData.code==200){
                            editImg  = false;
                            $(".diyawuEdit").show();
                            $(".diyawuW").hide();
                            $(this).hide();
                        }else{
                            layer.msg(JData.message)
                            location.reload();
                        }
                    });
                    break;
                default:
                    $(".baseEdit").show();
                    $(".baseW").hide();
                    break;
            }
     	 }else{
         	layer.alert("只能编辑一个模块");
         }
    }))
    //table点击按钮
    $(document).on('click','#getInfo1,#getState2,#getSeal3,#getInterview4,#getPingGu5',(function () {
    	 $(".textarea-edit").focus(function(){
	      var val = $(this).val();
	       $("#d1").width($(this).width())
	      $("#d1").html("<pre>" +val+" "+"</pre>");
	      var h = $("#d1").height() ;
	      $(this).height(h);
	    });
	    $(".textarea-edit").keyup(function(){
	         
	      var val = $(this).val();
	       $("#d1").width($(this).width())
	      $("#d1").html("<pre>" +val+" "+"</pre>");
	      var h = $("#d1").height() ;
	      $(this).height(h);
	    });
    	
    	if(editImg){
            var postionVal = $(this).data('val');
            var ppesid = $(this).data('ppesid');
	        switch (postionVal) {
	            case 1:
                    $.get('/project/get-base-data/',{project_id:project_id,package_id:package_id,ppesid:ppesid,postion:111},function (res) {
                        var JData = JSON.parse(res);
                        if (JData.code==200){
                            $(".infoEdit").show();
                            $(".infoW").hide();
                            $(this).hide();
                            editImg  = false;
                        }else{
                            layer.msg(JData.message)
                        }
                    });
	                break;
	            case 2:
                    $.get('/project/get-base-data/',{project_id:project_id,package_id:package_id,ppesid:ppesid,postion:111},function (res) {
                        var JData = JSON.parse(res);
                        if (JData.code==200){
                            $(".state2Edit").show();
                            $(".state2W").hide();
                            $(this).hide();
                            editImg  = false;
                        }else{
                            layer.msg(JData.message)
                        }
                    });
	                break;
	            case 3:
                    $.get('/project/get-base-data/',{project_id:project_id,package_id:package_id,ppesid:ppesid,postion:111},function (res) {
                        var JData = JSON.parse(res);
                        if (JData.code==200){
                            $(".seal3Edit").show();
                            $(".seal3W").hide();
                            $(this).hide();
                            editImg  = false;
                        }else{
                            layer.msg(JData.message)
                        }
                    });
	                break;
	            case 4:
                    $.get('/project/get-base-data/',{project_id:project_id,package_id:package_id,ppesid:ppesid,postion:114},function (res) {
                        var JData = JSON.parse(res);
                        if (JData.code==200){
                            $(".interview4Edit").show();
                            $(".interview4W").hide();
                            $(this).hide();
                            editImg  = false;
                        }else{
                            layer.msg(JData.message)
                        }
                    });
	                break;
	            case 5:
                    $.get('/project/get-base-data/',{project_id:project_id,package_id:package_id,ppesid:ppesid,postion:115},function (res) {
                        var JData = JSON.parse(res);
                        if (JData.code==200){
                            $(".PingGu5Edit").show();
                            $(".PingGu5W").hide();
                            $(this).hide();
                            editImg  = false;
                        }else{
                            layer.msg(JData.message)
                        }
                    });
	                break;
	            default:
                    $.get('/project/get-base-data/',{project_id:project_id,package_id:package_id,ppesid:ppesid,postion:111},function (res) {
                        var JData = JSON.parse(res);
                        if (JData.code==200){
                            $(".infoEdit").show();
                            $(".infoW").hide();
                            $(this).hide();
                            editImg  = false;
                        }else{
                            layer.msg(JData.message)
                        }
                    });
	                break;
	        }
	      }else{
         	layer.alert("只能编辑一个模块");
         }
    }))
    $(document).on('click','#getMake,#getMain,#getTeam',(function () {
    	 $(".textarea-edit").focus(function(){
	      var val = $(this).val();
	       $("#d1").width($(this).width())
	      $("#d1").html("<pre>" +val+" "+"</pre>");
	      var h = $("#d1").height() ;
	      $(this).height(h);
	    });
	    $(".textarea-edit").keyup(function(){
	         
	      var val = $(this).val();
	       $("#d1").width($(this).width())
	      $("#d1").html("<pre>" +val+" "+"</pre>");
	      var h = $("#d1").height() ;
	      $(this).height(h);
	    });
    	 	 //高亮显示开始
         $(document).on("focus",'textarea',function(){
				$(this).css({
							'border':'1px solid #2194f1'
				})
			})
		$(document).on("blur",'textarea',function(){
			$(this).css({
						'border':'1px solid #e2e2e2'
			})
		})
		
		 $(".borderColor").on("focus",'input',function(){
				$(this).css({
							'border':'1px solid #2194f1'
				})
			})
		$(".borderColor").on("blur",'input',function(){
			$(this).css({
						'border':'1px solid #e2e2e2'
			})
		})
		 $(".borderColor").on("focus",'select',function(){
				$(this).css({
							'border':'1px solid #2194f1'
				})
			})
		$(".borderColor").on("blur",'select',function(){
			$(this).css({
						'border':'1px solid #e2e2e2'
			})
		})
    	//高亮显示结束
    	
    	if(editImg){
    	  	
	        var postionVal = $(this).data('val');
	        $.get('/project/get-base-data',{'project_id':project_id,'postion':postionVal,'package_id':package_id},function (res) {
	            JsonRes = JSON.parse(res);
	            switch (postionVal){
	                case 9:
                        $.get('/project/get-base-data/',{project_id:project_id,postion:9,package_id:package_id},function (res) {
                            var JData = JSON.parse(res);
                            if (JData.code==200){
                                $(".zhuanRangXinXiEdit").html(JsonRes.data.res);
                                $(".zhuanRangXinXiEdit").show();
                                $(".zhuanRangXinXiW").hide();
                                $(this).hide();
                                editImg  = false;
                            }else{
                                layer.msg(JData.message)
                                location.reload();
                            }
                        });
	                    break;
	                case 11:
                        $.get('/project/get-base-data/',{project_id:project_id,postion:11,package_id:package_id},function (res) {
                            var JData = JSON.parse(res);
                            if (JData.code==200){
                                $(".liuZhuanJiWieHuEdit").html(JsonRes.data.res);
                                $(".liuZhuanJiWieHuEdit").show();
                                $(".liuZhuanJiWieHuW").hide();
                                $(this).hide();
                                editImg  = false;
                            }else{
                                layer.msg(JData.message)
                                location.reload();
                            }
                        });
	                    break;
	                case 13:
	                    $(".tuanDuiChengYuanEdit").html(JsonRes.data.res);
	                    $(".tuanDuiChengYuanEdit").show();
	                    $(".tuanDuiChengYuanW").hide();
	                     $(this).hide();
	                     editImg  = false;
	                    break;
	                default:
	                    $("#zhuanRangXinXiEdit").html(JsonRes.data.res);
	                    $("#zhuanRangXinXiEdit").show();
	                    $(".zhuanRangXinXiW").hide();
	                     $(this).hide();
	                     editImg  = false;
	                    break;
	            }
	        })
	        
        
         }else{
         	layer.alert("只能编辑一个模块");
         }
        
	   
        
    }))
     $(document).on("click",'.cancelInConfirm input[type="button"]',function(){
	    	editImg  = true;
	    	$('.topimg').show();
	    	$('.topimg img').show();
	    	$('.editImg').show();
	    })

</script>